## -*- coding: utf-8 -*-
<%!
import simplesite.model as model
%>
<%def name="breadcrumbs()">
    % if c.page and c.page.id != 1:
    <p>${render_breadcrumbs(c.breadcrumbs)}</p>
    % endif
</%def>

<%def name="tabs()">
    % if c.tabs:
    <div id="maintabs">
        <ul class="draglist">
            ${render_list(c.tabs, c.breadcrumbs[1].path, id='li1_', class_='list2')}
        </ul>
    </div>
    % endif
</%def>

<%def name="menu()">
% if len(c.breadcrumbs) > 2:
    <div id="menu">
        <ul class="draglist">
            ${render_list(c.menu, c.breadcrumbs[-1].path, id='li1_', class_='list2')}
        </ul>
    </div>
% endif
</%def>

<%def name="render_list(items, current, id, class_)">
% for item in items:
    % if item.path == current:
<li class="${class_} active" id="${id}${str(item.id)}"><span class="current"><a 
    href="${item.path_info}" id="current">${item.name}</a></span></li>\
    % else:
<li class="${class_}" id="${id}${str(item.id)}"
    onclick="document.location ='${item.path_info}'"
><span><a href="${item.path_info}">${item.name}</a></span></li>\
    % endif
% endfor
</%def>

<%def name="render_breadcrumbs(breadcrumbs)">
    % for i, item in enumerate(breadcrumbs):
    % if i < len(breadcrumbs) - 1:
        <a href="${item.path_info}">${item.name}</a> &gt;
    % elif isinstance(c.breadcrumbs[-1], model.Section):
        ${item.name} &gt;
    % else:
        ${item.name}
    % endif
    % endfor
</%def>

